<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>登录 | OA</title>


	<!--STYLESHEET-->
	<!--=================================================-->

	<!--Open Sans Font [ OPTIONAL ] -->
	<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&amp;subset=latin" rel="stylesheet">


	<!--Bootstrap Stylesheet [ REQUIRED ]-->
	<link href="../resource/core/css/bootstrap.min.css" rel="stylesheet">


	<!--Nifty Stylesheet [ REQUIRED ]-->
	<link href="../resource/core/css/nifty.min.css" rel="stylesheet">


	<!--Themify Icons [ OPTIONAL ]-->
	<link href="../resource/core/themify-icons/themify-icons.min.css" rel="stylesheet">


	<!--Magic Checkbox [ OPTIONAL ]-->
	<link href="../resource/core/plugins/magic-check/css/magic-check.min.css" rel="stylesheet">


	<!--app core [ REQUIRED ]-->
	<link href="../resource/core/css/core/app-core.css" rel="stylesheet">


	<!--JAVASCRIPT-->
	<!--=================================================-->

	<!--Page Load Progress Bar [ OPTIONAL ]-->
	<link href="../resource/core/plugins/pace/css/pace.min.css" rel="stylesheet">
	<script src="../resource/core/plugins/pace/js/pace.min.js"></script>


	<!--jQuery [ REQUIRED ]-->
	<script src="../resource/core/js/jquery-2.2.4.min.js"></script>


	<!--BootstrapJS [ RECOMMENDED ]-->
	<script src="../resource/core/js/bootstrap.min.js"></script>


	<!--Nifty Admin [ RECOMMENDED ]-->
	<script src="../resource/core/js/nifty.min.js"></script>

	<!-- jquery-qrcode -->
	<script src="../resource/core/plugins/jquery-qrcode/jquery.qrcode.min.js"></script>


	<script src="../resource/core/js/core/app-common.js"></script>
	<%--<link href="../resource/core/plugins/bootstrap-dialog/1.35.2/css/bootstrap-dialog.min.css" rel="stylesheet">--%>
	<%--<script src="../resource/core/plugins/bootstrap-dialog/1.35.2/js/bootstrap-dialog.min.js"></script>--%>
	<%--<script src="../resource/core/plugins/bootstrap-dialog/1.35.2/js/i18n/defaults-zh_CN.js"></script>--%>

	<!--=================================================

    REQUIRED
    You must include this in your project.


    RECOMMENDED
    This category must be included but you may modify which plugins or components which should be included in your project.


    OPTIONAL
    Optional plugins. You may choose whether to include it in your project or not.


    Detailed information and more samples can be found in the document.

    =================================================-->


</head>

<!--TIPS-->
<!--You may remove all ID or Class names which contain "demo-", they are only used for demonstration. -->

<body>
<div id="container" class="cls-container">

	<!-- BACKGROUND IMAGE -->
	<!--===================================================-->
	<div id="bg-overlay" class="bg-img login-bg"></div>


	<!-- LOGIN FORM -->
	<!--===================================================-->
	<div class="cls-content">
		<div class="cls-content-sm panel-group accordion" id="accordion">

			<div class="panel">
				<div class="panel-heading">
					<h4 class="panel-title">
						<a data-parent="#accordion" data-toggle="collapse" href="#collapseOne">帐号登录</a>
					</h4>
				</div>
				<div class="panel-collapse collapse in" id="collapseOne">
					<div class="panel-body">
						<form action="login" method="post">
							<c:if test="${error != null && error != ''}">
								<div class="alert alert-danger">
									<button class="close" data-dismiss="alert"><i class="pci-cross pci-circle"></i></button>
									${error}
								</div>
							</c:if>
							<div class="form-group">
								<input type="text" name="username" class="form-control" placeholder="用户名" autofocus>
							</div>
							<div class="form-group">
								<input type="password" name="password" class="form-control" placeholder="密码">
							</div>
							<div class="checkbox pad-btm text-left">
								<input id="demo-form-checkbox" class="magic-checkbox" type="checkbox">
								<label for="demo-form-checkbox">记住我</label>
							</div>
							<button class="btn btn-primary btn-lg btn-block" type="submit">登录</button>
						</form>
					</div>
					<div class="pad-all">

						<a href="#" class="btn-link mar-rgt">忘记密码 ?</a>
						<a id="newRegister" href="javascript:void(0);" class="btn-link mar-lft" data-toggle="modal" data-target=".bs-example-modal-lg">注册新账号</a>

					</div>
				</div>
			</div>
			<div class="panel">
				<div class="panel-heading">
					<h4 class="panel-title">
						<a data-parent="#accordion" data-toggle="collapse" href="#collapseTwo">二维码登录</a>
					</h4>
				</div>
				<div class="panel-collapse collapse" id="collapseTwo">
					<div class="panel-body">
						<div id="qrcode" class="add-tooltip" data-toggle="tooltip" data-container="body" data-placement="right" data-original-title="手机APP扫码登录">

						</div>
					</div>
				</div>
			</div>


		</div>
	</div>
	<!--===================================================-->

	<%--注册模态框--%>
	<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
		<div class="modal-dialog modal-lg" role="document">
			<div class="modal-content" style="padding: 10px">

				<div class="modal-header">
					<button id="regClose" type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">注册</h4>
				</div>

				<form id="form_member_create" class="form-horizontal" style="margin-top: 5px">
					<input type="hidden" name="keyId" id="keyId" value=""/>
					<div class="form-group">
						<label class="col-md-3 control-label">成员姓名</label>
						<div class="col-md-7">
							<input type="text" name="name" id="name" class="form-control" placeholder="请输入成员姓名">
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label">登录账号</label>
						<div class="col-md-7">
							<input type="text" name="account" id="account" class="form-control" placeholder="请输入成员手机号/邮箱账号">
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label">登录密码</label>
						<div class="col-md-7">
							<input type="password" name="password" id="password" class="form-control" placeholder="请输入登录密码">
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-3 control-label">密码确认</label>
						<div class="col-md-7">
							<input type="password" name="passwordConfirm" id="passwordConfirm" class="form-control" placeholder="再次输入登录密码">
						</div>
					</div>
					<div class="row" style="border-top: 1px solid #CCC;padding:5px 5px 0 0">
						<input type="button" class="btn btn-primary pull-right" id="saveReg" value="保存"/>
					</div>
				</form>


			</div>
		</div>
	</div>

</div>
<!--===================================================-->
<!-- END OF CONTAINER -->


</body>
</html>

<script>

	<%--var code = ${code};--%>
	<%--create_qrcode(code);--%>

	// 轮询校验code


	// 生成二维码
//	function create_qrcode(qrcode) {
//		$('#qrcode').qrcode({width: 200,height: 200,text: qrcode});
//	}

	$("#saveReg").click(function(){

		if($("#name").val()==""||$("#name").val()==null){
			__toastr_error("请填写姓名");
			return false;
		}

		if($("#account").val()==""||$("#account").val()==null){
			__toastr_error("请填写手机号");
			return false;
		}

		if($("#password").val()==""||$("#password").val()==null){
			__toastr_error("请填写密码");
			return false;
		}

		if($("#passwordConfirm").val()==""||$("#passwordConfirm").val()==null){
			__toastr_error("请填写确认密码");
			return false;
		}

		if($("#password").val()!=$("#passwordConfirm").val()){
			__toastr_error("两次密码不一样");
			return false;
		}

		var url="<%=path%>/com/personnelInfo/newReg";
		var params={"name":$("#name").val(),"account":$("#account").val(),"password":$("#password").val()};
		$.ajax({
			type:"post",
			url:url,
			data:params,
			dataType:"json",
			success:function(data){
				if(data.state==0){
					__toastr_error(data.message);
				}else{
					__toastr_success(data.message);
					$("#regClose").trigger("click");
					$("#form_member_create>div>div>input").val("");
				}
			}
		});
	});


</script>
